package com.lineage.data.npc.quest;

import com.lineage.config.ConfigOther;
import com.lineage.data.executor.NpcExecutor;
import com.lineage.server.model.Instance.L1NpcInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_NPCTalkReturn;
import com.lineage.server.serverpackets.ServerBasePacket;
import com.lineage.server.timecontroller.event.ranking.RankingKillTimer;

public class Npc_KillerRanking extends NpcExecutor {
  public static NpcExecutor get() {
    return new Npc_KillerRanking();
  }
  
  public int type() {
    return 3;
  }
  
  public void talk(L1PcInstance pc, L1NpcInstance npc) {
    pc.sendPackets(
        (ServerBasePacket)new S_NPCTalkReturn(npc.getId(), "y_k_1", new String[] { String.valueOf(ConfigOther.killlevel) }));
  }
  
  public void action(L1PcInstance pc, L1NpcInstance npc, String cmd, long amount) {
    String[] userName = null;
    if (cmd.equalsIgnoreCase("1")) {
      userName = RankingKillTimer.killName();
      if (userName != null)
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(npc.getId(), "y_k_2", userName)); 
    } else if (cmd.equalsIgnoreCase("2")) {
      userName = RankingKillTimer.deathName();
      if (userName != null)
        pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(npc.getId(), "y_k_3", userName)); 
    } 
  }
}
